package com.qingcheng.service.impl;

/**
 * @author yangjun
 * 2019/7/10
 * 8:44
 */

import com.qingcheng.service.goods.CategoryService;
import com.qingcheng.service.goods.SkuService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 项目启动,加载categoryTree到缓存
 */
@Component
public class Init implements InitializingBean{
    @Autowired
    private CategoryService categoryService;
    @Autowired
    private SkuService skuService;
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("-----预热缓存------");
        categoryService.saveCategoryTreeToRedis();//加载商品分类导航数据
        skuService.saveAllPriceToRedis();//加载价格数据
    }
}
